package com.pcbly.web.components.utils.converters;

import java.math.BigDecimal;

import org.apache.commons.beanutils.Converter;
import org.apache.commons.beanutils.converters.BigDecimalConverter;

public class MyBigDecimalConverter implements Converter {
	 public MyBigDecimalConverter(){}
	 @SuppressWarnings("unchecked")
	public Object convert(Class type, Object value)
	    {
	        if(type.equals(java.math.BigDecimal.class) && value == null)
	            return newDefaultBigDecimal();
	        else
	            return (new BigDecimalConverter()).convert(type, value);
	    }

	 private static BigDecimal newDefaultBigDecimal()
	    {
	        return new BigDecimal(0.0D);
	    }
}
